//
//  DesignCenterViewController.m
//  ForestPack
//
//  Created by 郑洲 on 2018/7/3.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "DesignCenterViewController.h"
#import "UIView+Utils.h"
#import "DesignCenterSectionView.h"
#import "DesignCenterCollectionTableCell.h"
#import "FPDesignCenterHomeCell.h"
#import "UIViewController+Extension.h"
#import "SearchViewController.h"
#import "MessageViewController.h"
#import "FPDesignHomeHeaderView.h"
#import "FPPostListViewController.h"
#import "NeedCenterViewController.h"
#import "FFlexibleDesignViewController.h"
#import "FPDesignerShopViewController.h"
#import "CompleteConmmandInfoViewController.h"
#import "SearchRecordViewController.h"
#import "FPCommodityDetailVC.h"
#import "CaseDetailsViewController.h"
#import "SWQRCode.h"
#import "SearchRecordViewController.h"
#import "ShopAdornViewController.h"
#import "PublishNeedViewController.h"
#import "FPOrderDetailVC.h"
#import "EmployeeOrderDetailVC.h"
#import "CompareDesignOrderDetailVC.h"
#import "DesignSideOrderDetailVC.h"
#import "RecommendProductModel.h"
#import "YourDesignerModel.h"
#import "CHCardItemModel.h"
#import "CustomDemandListModel.h"
#import "CaseDetailsViewController.h"

@interface DesignCenterViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>

@property (nonatomic,strong)  UITableView    * tableView;
@property (nonatomic,strong)  NSMutableArray * RecommendProduct;
@property (nonatomic,strong)  NSMutableArray * YourDesigner;
@property (nonatomic, strong) NSMutableArray * createAreaArray;

@property (nonatomic,strong)  CustomDemandListModel  * customDemandListModel;
@property (nonatomic, strong) NSMutableArray         * customDemandListArray;

@end

@implementation DesignCenterViewController

- (NSMutableArray *)customDemandListArray
{
    if (_customDemandListArray == nil) {
        _customDemandListArray = [[NSMutableArray alloc] init];
    }
    return _customDemandListArray;
}

- (NSMutableArray *)createAreaArray
{
    if (_createAreaArray == nil) {
        _createAreaArray = [[NSMutableArray alloc] init];
    }
    return _createAreaArray;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.navigationController.navigationBar.hidden = NO;
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewDidLoad {
    _RecommendProduct = [[NSMutableArray alloc] init];
    _YourDesigner = [[NSMutableArray alloc] init];
    [super viewDidLoad];
    [self setViewUI];
    
    [self requestCustomDemandListData];
    [self getRecommendProductData];
    [self getYourDesignerData];
    [self getCreateAreaData];
    
}

-(void)requestCustomDemandListData
{
    if (!kNSUDefaultReadKey(@"token")) {
        return;
    }
    NSString *url = [NSString stringWithFormat:@"%@app/customer_demand",REQUESTHEADER];
    NSDictionary *dict = @{@"token":kNSUDefaultReadKey(@"token")};
    [HttpManager postHttpRequestByPost:url andParameter:dict success:^(id successResponse) {
        NSString *status = [NSString stringWithFormat:@"%@",successResponse[@"status"]];
//        NSDictionary *dic = successResponse;
        if ([status isEqualToString:@"1"]) {
            NSError *error;
            for(NSDictionary *dict in successResponse[@"data"]){
                CustomDemandListModel * customDemandListModel = [[CustomDemandListModel alloc] initWithDictionary:dict error:&error];
                [self.customDemandListArray addObject:customDemandListModel];
            }
            [self.tableView reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, 1)] withRowAnimation:UITableViewRowAnimationNone];
            
        }else {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
        }
    } andFailure:^(id failureResponse) {
        [HttpManager showFail];
    }];
    
}

#pragma mark - 消息按钮的点击事件
-(void)messageClick
{
    MessageViewController *messageVC = [[MessageViewController alloc] init];
    [self.navigationController pushViewController:messageVC animated:true];
}

#pragma mark - 搜索按钮的点击事件
-(void)searchClick
{
    SearchViewController *searchVC = [[SearchViewController alloc] init];
    [self.navigationController pushViewController:searchVC animated:true];
}

#pragma mark - 扫描按钮的点击事件
-(void)scanningClick
{
    NSLog(@"*********************");
    SWQRCodeConfig *config = [[SWQRCodeConfig alloc]init];
    config.scannerType = SWScannerTypeBoth;
    
    SWQRCodeViewController *qrcodeVC = [[SWQRCodeViewController alloc]init];
    
    qrcodeVC.codeConfig = config;
    [self.navigationController pushViewController:qrcodeVC animated:YES];
}

#pragma mark -- 扫一扫API,处理扫一扫结果
- (void)sw_handleWithValue:(NSString *)value
{
    NSLog(@"sw_handleWithValue === %@", value);
}

#pragma mark -- 相册选取图片无法读取数据
- (void)sw_didReadFromAlbumFailed
{
    NSLog(@"sw_didReadFromAlbumFailed");
}

- (void)showCreateAreaDetail:(UIButton *)button {
    DesignCenterCardModel *model = _createAreaArray[button.tag - 500];
    CaseDetailsViewController *vc = [[CaseDetailsViewController alloc] init];
    vc.design_id = [model.Id integerValue];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - 实现tableView的代理和数据源
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 5;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 1) {
        return self.customDemandListArray.count;
    }
    return 1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        return 80;
    }else if (indexPath.section == 1) {
        return 56;
    }else if (indexPath.section == 2) {
        return 200;
    }else if (indexPath.section == 3) {
        return 226;
    }else{
        return 185;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return 38;
    }
    return 54;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        DesignCenterSectionView * sectionView = [DesignCenterSectionView sectionViewWithHeight:30];
        sectionView.backgroundColor = [UIColor whiteColor];
        sectionView.userInteractionEnabled = YES;
        sectionView.detailClick = ^{
//            FPPostDetailViewController *postDetailVC = [[FPPostDetailViewController alloc] init];
//            [self.navigationController pushViewController:postDetailVC animated:true];
        };
        sectionView.postListClick = ^{
            FPPostListViewController *postListVC = [[FPPostListViewController alloc] init];
            [self.navigationController pushViewController:postListVC animated:true];
        };
        
        return sectionView;
    }else if (section == 1){
        DesignCenterSectionHeaderView * sectionHeaderView = [DesignCenterSectionHeaderView sectionHeaderViewWithHeight:54 withTitle:@"客户需求"];
        sectionHeaderView.reconmmandMoreClick = ^{
            NeedCenterViewController *vc = [[NeedCenterViewController alloc] init];
            [self.navigationController pushViewController:vc animated:YES];
        };
        sectionHeaderView.backgroundColor = [UIColor whiteColor];
        return sectionHeaderView;
    }else if(section == 2){
        DesignCenterSectionHeaderView * sectionHeaderView = [DesignCenterSectionHeaderView sectionHeaderViewWithHeight:54 withTitle:@"设计师商品"];
        sectionHeaderView.reconmmandMoreClick = ^{
            SearchRecordViewController *vc = [[SearchRecordViewController alloc] init];
            vc.selectIndex = 2;
            [self.navigationController pushViewController:vc animated:YES];
            
        };
        sectionHeaderView.backgroundColor = [UIColor whiteColor];
        return sectionHeaderView;
    }else if (section == 3){
        DesignCenterSectionHeaderView * sectionHeaderView = [DesignCenterSectionHeaderView sectionHeaderViewWithHeight:54 withTitle:@"你的设计师"];
        sectionHeaderView.reconmmandMoreClick = ^{
            SearchRecordViewController *vc = [[SearchRecordViewController alloc] init];
            vc.selectIndex = 1;
            [self.navigationController pushViewController:vc animated:YES];
        };
        sectionHeaderView.backgroundColor = [UIColor whiteColor];
        return sectionHeaderView;
    }else{
        DesignCenterSectionHeaderView * sectionHeaderView = [DesignCenterSectionHeaderView sectionHeaderViewWithHeight:54 withTitle:@"创意空间"];
        sectionHeaderView.reconmmandMoreClick = ^{
            SearchRecordViewController *vc = [[SearchRecordViewController alloc] init];
            vc.selectIndex = 3;
            [self.navigationController pushViewController:vc animated:YES];
        };
        sectionHeaderView.backgroundColor = [UIColor whiteColor];
        return sectionHeaderView;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    if (section == 1) {
        return 80;
    }
    return 10;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    if (section == 1) {
        DesignCenterSectionFooterView * sectionFooterView = [DesignCenterSectionFooterView sectionFooterViewWithHeight:80];
        sectionFooterView.backgroundColor = [UIColor whiteColor];
        sectionFooterView.reconmmandPublicClick = ^{
            PublishNeedViewController *publicNeedVC = [[PublishNeedViewController alloc] init];
            [self.navigationController pushViewController:publicNeedVC animated:true];
        };
        return sectionFooterView;
    }else{
        UIView *view = [[UIView alloc] init];
        return view;
    }
 
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        DesignCenterBtnTableViewCell * cell = [DesignCenterBtnTableViewCell cellBtnWithTableView:tableView andIndexPath:indexPath andCellHeight:80];
        cell.waterClick = ^{
            SearchRecordViewController *searchRecordVC = [[SearchRecordViewController alloc] init];
            searchRecordVC.labels = @"水印设计";
            searchRecordVC.isPrefixDesign = YES;
            [self.navigationController pushViewController:searchRecordVC animated:true];
        };
        cell.colorClick = ^{
            SearchRecordViewController *searchRecordVC = [[SearchRecordViewController alloc] init];
            searchRecordVC.labels = @"彩印设计";
            searchRecordVC.isPrefixDesign = YES;
            [self.navigationController pushViewController:searchRecordVC animated:true];
        };
        cell.digitalClick = ^{
            SearchRecordViewController *searchRecordVC = [[SearchRecordViewController alloc] init];
            searchRecordVC.labels = @"数码设计";
            searchRecordVC.isPrefixDesign = YES;
            [self.navigationController pushViewController:searchRecordVC animated:true];
        };
        cell.structClick = ^{
            SearchRecordViewController *searchRecordVC = [[SearchRecordViewController alloc] init];
            searchRecordVC.labels = @"结构设计";
            searchRecordVC.isPrefixDesign = YES;
            [self.navigationController pushViewController:searchRecordVC animated:true];
        };
        return cell;
    }else if (indexPath.section == 1){
        FPDesignCenterHomeCell * cell = [FPDesignCenterHomeCell cellWithTableView:tableView andIndexPath:indexPath andCellHeight:80];
        cell.customDemandListModel = self.customDemandListArray[indexPath.row];
        return cell;
    }else if (indexPath.section == 2){
        DesignCenterCollectionTableCell * cell = [DesignCenterCollectionTableCell cellWithTableView:tableView andIndexPath:indexPath andCellHeight:200];
        cell.commodityClick = ^(NSInteger index) {
            RecommendProductModel *model = self.RecommendProduct[index];
            FPCommodityDetailVC *vc = [[FPCommodityDetailVC alloc] init];
            vc.design_id = [model.product_id integerValue];
            [self.navigationController pushViewController:vc animated:true];
        };
        cell.dataArry = self.RecommendProduct;
        return cell;
    }else if (indexPath.section == 3){
        YourDesignCenterCollectionTableCell * cell = [YourDesignCenterCollectionTableCell cellWithTableView:tableView andIndexPath:indexPath andCellHeight:226];
        cell.contactedClick = ^(NSInteger index) {
            YourDesignerModel *model = self.YourDesigner[index];
            ShopAdornViewController *designShopVC = [[ShopAdornViewController alloc] init];
            designShopVC.shop_id = model.store_id;
            designShopVC.isMine = NO;
            [self.navigationController pushViewController:designShopVC animated:true];
        };
        cell.dataArray = self.YourDesigner;
        return cell;
    }
    
    static NSString *cellId = @"productCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    for (UIView *subView in cell.subviews) {
        [subView removeAllSubviews];
    }
    UIScrollView *bigScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScreenX375(165))];
    bigScrollView.backgroundColor = [UIColor whiteColor];
    bigScrollView.contentSize = CGSizeMake(self.createAreaArray.count * SCREEN_WIDTH, 0);
    bigScrollView.bounces = YES;
    bigScrollView.showsHorizontalScrollIndicator = NO;
    bigScrollView.showsVerticalScrollIndicator = NO;
    bigScrollView.delegate = self;
    bigScrollView.pagingEnabled = YES;
    [cell addSubview:bigScrollView];
    
    for (int i = 0; i < self.createAreaArray.count; i++) {
        DesignCenterCardModel *model = self.createAreaArray[i];
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(13) + i * SCREEN_WIDTH, 0, SCREEN_WIDTH - ScreenX375(26), ScreenX375(165))];
        [imageView sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:nil options:SDWebImageRetryFailed];
        imageView.backgroundColor = TABLEVIEW_BACKGROUNDCOLOR;
        [bigScrollView addSubview:imageView];
        
        UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(24) + i * SCREEN_WIDTH, ScreenX375(140), ScreenX375(240), ScreenX375(20))];
        nameLabel.textColor = [UIColor whiteColor];
        nameLabel.font = Kfont(14);
        nameLabel.text = model.design_name;
        [bigScrollView addSubview:nameLabel];
        
        UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(i * SCREEN_WIDTH, 0, SCREEN_WIDTH, ScreenX375(165))];
        button.tag = 500 + i;
        [button addTarget:self action:@selector(showCreateAreaDetail:) forControlEvents:UIControlEventTouchUpInside];
        [bigScrollView addSubview:button];
    }
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:false];
//    if (indexPath.section == 0) {
//        DesignCenterBtnTableViewCell * cell = [DesignCenterBtnTableViewCell cellBtnWithTableView:tableView andIndexPath:indexPath andCellHeight:80];
//        cell.designClick = ^{
//            FFlexibleDesignViewController *flexDesignVC = [[FFlexibleDesignViewController alloc] init];
//            [self.navigationController pushViewController:flexDesignVC animated:true];
//        };
//    }
    if (indexPath.section == 1) {
//        FPOrderDetailVC *vc = [[FPOrderDetailVC alloc] init];
//        [self.navigationController pushViewController:vc animated:true];
        if (indexPath.row == 0) {
            EmployeeOrderDetailVC *vc = [[EmployeeOrderDetailVC alloc] init];
            [self.navigationController pushViewController:vc animated:true];
        }else if (indexPath.row == 1){
            CompareDesignOrderDetailVC *vc = [[CompareDesignOrderDetailVC alloc] init];
            [self.navigationController pushViewController:vc animated:true];
        }else{
            DesignSideOrderDetailVC *vc = [[DesignSideOrderDetailVC alloc] init];
            [self.navigationController pushViewController:vc animated:true];
        }
        
    }
    
    
    
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
//    searchKey = textField.text;
//    UITableView *tableView = _tableArray[_currentIndex];
//    [self.tableView.mj_header beginRefreshing];
    [textField resignFirstResponder];
    return NO;
}

#pragma mark - UI 部分
- (void)setViewUI
{
    [self setTableViewUI];
}

- (void)setNavViewUI
{
    [self setRightButton:[UIImage imageNamed:@"消息"] title:nil target:self action:@selector(messageClick)];
}

- (void)setTableViewUI
{
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, -STATUS_BAR_HEIGHT, self.view.width, self.view.height - STATUS_BAR_HEIGHT) style:UITableViewStyleGrouped];

    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.tableFooterView = [UIView new];
    self.tableView.tableHeaderView = [self setHeaderView];
    self.tableView.backgroundColor = TABLEVIEW_BACKGROUNDCOLOR;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    
    [self.view addSubview:self.tableView];
}

- (UIView *)setHeaderView
{
    UIView * headerView = [[UIView alloc] init];
    headerView.size = CGSizeMake(SCREEN_WIDTH, 200);
    headerView.backgroundColor = TestrandomColor;
    
    UIImageView *bjImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 200)];
    bjImageView.image = [UIImage imageNamed:@"头部背景暗"];
    bjImageView.userInteractionEnabled = YES;
    [headerView addSubview:bjImageView];
    
    UIButton *messageButton = [UIButton buttonWithType:UIButtonTypeCustom];
    messageButton.frame = CGRectMake(SCREEN_WIDTH - 44, 30, 22, 21);
    [messageButton setImage:[UIImage imageNamed:@"消息"] forState:UIControlStateNormal];
    [messageButton addTarget:self action:@selector(messageClick) forControlEvents:UIControlEventTouchUpInside];
    [headerView addSubview:messageButton];
    
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.frame = CGRectMake(headerView.left + 150, headerView.top + 50, 75, 20);
    titleLabel.text = @"天天特惠";
    titleLabel.font = [UIFont fontWithName:@"MicrosoftYaHei" size:18];
    titleLabel.textColor = RGB_COLOR(255,255,255);
    [headerView addSubview:titleLabel];
    
    UILabel *desLabel= [[UILabel alloc] init];
    desLabel.frame = CGRectMake(headerView.left + 99, titleLabel.bottom + 10, 190, 13);
    desLabel.text = @"设计/营销/修图，创意服务一元起";
    desLabel.font = [UIFont systemFontOfSize:12];
    desLabel.textColor = RGB_COLOR(255,255,255);
    [headerView addSubview:desLabel];
    
    UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(20, desLabel.bottom + 20, 40, 28)];
    UIImageView *leftImage = [[UIImageView alloc] initWithFrame:CGRectMake(12, 4, 22, 22)];
    leftImage.image = [UIImage imageNamed:@"搜索白色"];
    [leftView addSubview:leftImage];
    [bjImageView addSubview:leftView];
        
    UIButton *bjButton = [UIButton buttonWithType:UIButtonTypeCustom];
    bjButton.frame = CGRectMake(13, desLabel.bottom + 20, SCREEN_WIDTH - 26, 30);
    [bjButton setTitle:@"搜索您需要的人才，如包装设计等" forState:UIControlStateNormal];
    [bjButton setTitleColor:RGB_COLOR(255,255,255) forState:UIControlStateNormal];
    bjButton.titleLabel.font = [UIFont systemFontOfSize:12];
    bjButton.titleLabel.textAlignment = NSTextAlignmentLeft;
    bjButton.layer.cornerRadius = 15;
    bjButton.clipsToBounds = YES;
    bjButton.backgroundColor = RGBACOLOR(243,243,243,0.6);
    [bjButton addTarget:self action:@selector(searchClick) forControlEvents:UIControlEventTouchUpInside];
    [headerView addSubview:bjButton];
    
    UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 26 - 15 - 22, desLabel.bottom + 20, 30, 22)];
    [headerView addSubview:rightView];
    UIImageView *rightImage = [[UIImageView alloc] initWithFrame:CGRectMake(12, 4, 22, 22)];
    rightImage.image = [UIImage imageNamed:@"扫一扫"];
    [rightView addSubview:rightImage];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, 30, 22);
    [rightView addSubview:button];
//    [button addTarget:self action:@selector(scanningClick) forControlEvents:UIControlEventTouchUpInside];
    
    return headerView;
}

- (void)getCreateAreaData
{
    [HttpManager postHttpRequestByPost:[NSString stringWithFormat:@"%@app/recommend_create_space",REQUESTHEADER] andParameter:nil success:^(id successResponse) {
        NSString *status = [NSString stringWithFormat:@"%@",successResponse[@"status"]];
        if ([status isEqualToString:@"1"]) {
            [self.createAreaArray removeAllObjects];
            NSArray *arr = [[successResponse[@"data"] reverseObjectEnumerator] allObjects];
            for (NSDictionary *dict in arr) {
                DesignCenterCardModel *model = [[DesignCenterCardModel alloc] initWithDic:dict];
                [self.createAreaArray addObject:model];
            }
            [self.tableView reloadData];
        }else {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
        }
    } andFailure:^(id failureResponse) {
        [HttpManager showFail];
    }];
}

-(void)getRecommendProductData{
    [HttpManager postHttpRequestByPost:[NSString stringWithFormat:@"%@app/recommend_design_product",REQUESTHEADER] andParameter:nil success:^(id successResponse) {
        NSString *status = [NSString stringWithFormat:@"%@",successResponse[@"status"]];
        if ([status isEqualToString:@"1"]) {
            NSError *error = nil;
            for(NSDictionary *dict in successResponse[@"data"]){
                RecommendProductModel *model = [[RecommendProductModel alloc] initWithDictionary:dict error:&error];
                model.product_id = dict[@"id"];
                [self.RecommendProduct addObject:model];
            }
            [self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:2]] withRowAnimation:UITableViewRowAnimationNone];
        }else {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
        }
    } andFailure:^(id failureResponse) {
        [HttpManager showFail];
    }];
}

-(void)getYourDesignerData{
    if (!kNSUDefaultReadKey(@"token")) {
        return;
    }
    NSDictionary *parameter = @{@"token":kNSUDefaultReadKey(@"token")};
    [HttpManager postHttpRequestByPost:[NSString stringWithFormat:@"%@app/cooperate_designer",REQUESTHEADER] andParameter:parameter success:^(id successResponse) {
        NSString *status = [NSString stringWithFormat:@"%@",successResponse[@"status"]];
        if ([status isEqualToString:@"1"]) {
            NSError *error = nil;
            for(NSDictionary *dict in successResponse[@"data"]){
                YourDesignerModel *model = [[YourDesignerModel alloc] initWithDictionary:dict error:&error];
                model.store_id = dict[@"id"];
                [self.YourDesigner addObject:model];
            }
            [self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:3]] withRowAnimation:UITableViewRowAnimationNone];
        }else {
            [HttpManager showNoteMsg:[NSString stringWithFormat:@"%@",successResponse[@"msg"]]];
        }
    } andFailure:^(id failureResponse) {
        [HttpManager showFail];
    }];
}
@end
